<% content_for :action_nav do %>
  <ul id="act-nav">
    <li><%= link_to "Resend", :action => :resend, :id => @order %></li>
  </ul>
<% end %>

<%= render :partial => 'shared/order_details', :locals => {:order => @order} -%>

<table class="order-address">
  <tr>
    <th>Ship Address</th>
    <th>Bill Address</th>
  </tr>
  <tr>
    <td width="50%">
      <%= render :partial => 'address', :locals => {:address => @order.ship_address} -%>      
    </td>
    <td width="50%">
      <%= render :partial => 'address', :locals => {:address => @order.bill_address} -%>
    </td>
  </tr>
</table>
<table class="order-address">
  <tr>
    <th>Email</th>
  </tr>
  <tr>
    <td><%=in_place_editor_field :user, :email %></td>
  </tr>
</table>
<table class="basic-table">
  <tr>
    <th>Operation</th>
		<th>User</th>
    <th>Date/Time</th>
  </tr>
  <% @order.order_operations.each do |o| %>
    <tr>
      <td><%=OrderOperation::OperationType.from_value o.operation_type%></td>
			<td><%=o.user.login%></td>
      <td><%=o.created_at.to_s(:db)%></td>
    </tr>
  <% end %>
  <% if @order.order_operations.empty? %>
    <tr>
      <td colspan="3">None Available.</td>
    </tr>
  <% end %>	
</table>
<table class="full-table">
  <tr>
    <th>Transaction</th>
    <th>Amount</th>
    <th>Card Number</th>
    <th>Type</th>
    <th>Response Code</th>
    <th>Date/Time</th>
  </tr>
	<% if @order.credit_card %>
	  <% @order.credit_card.txns.each do |t| %>
	    <tr>
	      <td><%=Txn::TxnType.from_value t.txn_type.to_i%></td>
	      <td><%=t.amount%></td>
	      <td><%=t.credit_card.display_number%></td>
	      <td><%=t.credit_card.cc_type%></td>
	      <td><%=t.response_code%></td>
	      <td><%=t.created_at.to_s(:db)%></td>
	    </tr>
	  <% end %>
	<% end %>
</table>
<%= link_to "Back", :controller => :orders %>